<?php
/**
 * @filename NoQuarterState.php
 * @author LD King
 * @encoding UTF-8
 * @date 2008-9-13 | 下午08:10:43
 * @package 
 * @subpackage 
 * @usage 
 * @note 没钱不给糖果
 * @copyright Copyright (c) 2007 - 2008 LD (http://mifunny.info)
 * @version $Id: $
 */

include_once 'State.php';
include_once 'GumballMachine.php';

/**
 * 还没有25美分
 *
 */
class NoQuarterState implements State {
	/**
	 * 糖果机
	 * 
	 * @var GumballMachine
	 */
	public $gumballMachine;
	
	/**
	 * 初始化，传入糖果机对象
	 *
	 * @param GumballMachine $gumballMachine
	 */
	public function __construct(GumballMachine $gumballMachine) {
		$this->gumballMachine = $gumballMachine;
	}
	
	/**
	 * @see State::dispense()
	 *
	 */
	public function dispense() {
		echo "想要糖果，先付钱！";
	}
	
	/**
	 * @see State::ejectQuarter()
	 *
	 */
	public function ejectQuarter() {
		echo "小样，还没投币就像拿钱，滚！";
	}
	
	/**
	 * @see State::insertQuarter()
	 *
	 */
	public function insertQuarter() {
		echo "你投入了25美分，wait...";
		$this->gumballMachine->setState($this->gumballMachine->getHasQuarterState());
	}
	
	/**
	 * @see State::turnCrank()
	 *
	 */
	public function turnCrank() {
		echo "不要在白费力气转了，没有投币，没有糖果！";
	}
} /* END class NoQuarterState */
?>